//
//  LKWorkOrderUpdateViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/4/26.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKWorkOrderUpdateViewController.h"
#import "LKWorkOrderListDetailCell.h"
#import "LKWorkOrderListDetailPictureCell.h"
#import "LKWorkOrderListDetailOnlyImageCell.h"
#import "LKWorkOrderDetailPOSPicCell.h"
#import "LKWorkOrderDetailContractCell.h"
#import "LKWorkOrderDetailContractDetailCell.h"
#import "LKWorkOrderDetailOtherPicCell.h"
#import "LKConfirmCustomInforViewController.h"
#import "LKChooseProductViewController.h"
#import "LKAddProtocalMessageViewController.h"
#import "LKUploadFileViewController.h"
#import "LKDiscountTicketViewController.h"
#import "LKChooseBankCardViewController.h"
#import "LKOrderEditBottomView.h"
#import "LKAddWorkCustomViewController.h"
#import "LKAddProtocalMessageViewController.h"
#import "LKChooseProductDetailViewController.h"
#import "LKChooseBankCardListViewController.h"
#import "LKUpLoadChangeFileView.h"
#import "LKCustomerAttachModel.h"
#import "YLInvestmentTableViewCell.h"
#import "LKOrderRecordViewController.h"
@interface LKWorkOrderUpdateViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)LKBaseTableview *tableview;
@property(nonatomic,strong)NSArray *headerTitlsArray;
@property(nonatomic,strong)NSArray *headerIconsArray;
@property(nonatomic,strong)NSMutableArray *cellContentArray;
@property(nonatomic,strong)NSMutableDictionary *indexPathDic;
@property(nonatomic,assign)BOOL productFlag;
@property(nonatomic,assign)BOOL bankFlag;
@property(nonatomic,assign)BOOL secondbankFlag;
@property(nonatomic,assign)BOOL contractHomeFlag;
@property(nonatomic,assign)BOOL contractDetailFlag;
@property(nonatomic,assign)BOOL POSFlag;
@property(nonatomic,assign)BOOL otherFlag;
@property(nonatomic,strong)LKOrderEditBottomView *bottomView;
@property(nonatomic,assign)BOOL moneyIsFirst;
@property(nonatomic,strong)LKUpLoadChangeFileView *uploadChangeFileView;
@property(nonatomic,strong)UIView *uploadBgView;
@property(nonatomic,strong)NSMutableArray *orderAttachsChangeArray;
@property(nonatomic,assign)BOOL waitSignal;

@end

@implementation LKWorkOrderUpdateViewController
-(LKBaseTableview *)tableview{
    if (!_tableview) {
        WS(weakSelf)
//        _bottomView = [[[NSBundle mainBundle] loadNibNamed:@"LKOrderEditBottomView" owner:self options:nil] lastObject];
//        [self.view addSubview:_bottomView];
//        [_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.bottom.equalTo(self.view);
//            make.height.mas_equalTo(69);
//        }];
//        [[_bottomView.forwardBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
//            [weakSelf.navigationController popViewControllerAnimated:YES];
//        }];
//        [_bottomView.forwardBtn setTitle:@"保存" forState:UIControlStateNormal];
//        [_bottomView.nextBtn addTarget:self action:@selector(submitOrderInformation) forControlEvents:UIControlEventTouchUpInside];
//        [_bottomView.nextBtn setTitle:@"提交" forState:UIControlStateNormal];
        _tableview = [LKBaseTableview setTableviewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT + 10, WIDTH , HEIGHT - NAVIGATION_BAR_HEIGHT - 60) style:UITableViewStyleGrouped registercellClasss:@[@"LKWorkOrderListDetailCell",@"LKWorkOrderListDetailPictureCell",@"LKWorkOrderListDetailOnlyImageCell",@"LKWorkOrderDetailContractCell",@"LKWorkOrderDetailContractDetailCell",@"LKWorkOrderDetailOtherPicCell",@"LKWorkOrderDetailPOSPicCell",@"YLInvestmentTableViewCell"]];
        [self.view addSubview:_tableview];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableview;
}
-(RACSubject *)backClearSub{
    if (!_backClearSub) {
        _backClearSub = [RACSubject subject];
    }
    return _backClearSub;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = self.theme;
    self.tableview.estimatedRowHeight = 200;
    self.moneyIsFirst = YES;
    self.waitSignal = YES;
    NSLog(@"字典%@",[self.addOrderModel properties_aps]);
    NSDictionary *mutableDic = [self.addOrderModel properties_aps];
    NSArray *keysValue = [mutableDic allKeys];
    NSMutableDictionary *newSetDic = [NSMutableDictionary dictionary];
    for (NSInteger i = 0; i < keysValue.count; i++) {
        NSString *key = keysValue[i];
        NSLog(@"键%@",key);
        NSString *value = [mutableDic objectForKey:key];
        NSLog(@"值%@",value);
        char headTitle = [key characterAtIndex:0] + 32;
        NSRange range = NSMakeRange(0, 1);
        key = [key stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",headTitle]];
        NSDictionary *newDic = [NSDictionary dictionaryWithObject:value forKey:key];
        [newSetDic addEntriesFromDictionary:newDic];
    }
    NSLog(@"最新键值对%@",newSetDic);
    [self setAddOrderAllInformationWith];
    if (self.updateId) {
        [self getOrderDetailInformaiton];
//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getOrderDetailInformaiton) name:@"AddcustomerReloadTableview" object:nil];
    }
    [self createBottomFuckView];
    
    
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getOrderNewInformation:) name:@"AddcustomerReloadTableview" object:nil];
    
    
    
    
//    if (_model.customerCode) {
//
////       [self getCurrentCustomerInformation];
//    }else{
//        [self.tableview reloadData];
//    }
    
    // Do any additional setup after loading the view.
}

/**
 获取编辑之后的详细信息
 */
-(void)getOrderNewInformation:(NSNotification *)notice{
    NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:_model.customerCode,@"customerCode", nil];
    [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:getAddOrderBasicUrl header:[LKUserInforTool header] parameters:param progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        LKOrderModel *model = [LKOrderModel modelWithDictionary:responseObject[@"result"]];
        NSDictionary *mutableDic = [model properties_aps];
        NSArray *keysValue = [mutableDic allKeys];
        NSMutableDictionary *newSetDic = [NSMutableDictionary dictionary];
        for (NSInteger i = 0; i < keysValue.count; i++) {
            NSString *key = keysValue[i];
            NSLog(@"键%@",key);
            NSString *value = [mutableDic objectForKey:key];
            NSLog(@"值%@",value);
            char headTitle = [key characterAtIndex:0] - 32;
            NSRange range = NSMakeRange(0, 1);
            key = [key stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",headTitle]];
            NSDictionary *newDic = [NSDictionary dictionaryWithObject:value forKey:key];
            [newSetDic addEntriesFromDictionary:newDic];
        }
        NSLog(@"最新键值对%@",newSetDic);
        self.addOrderModel.CustomerName = model.customerName;
        self.addOrderModel.CustomerCode = model.customerCode;
        self.addOrderModel.CustomerId = model.customerId;
        self.addOrderModel.IdentityId = model.identityId;
        self.addOrderModel.IdentitfyPhotoUrl = model.identitfyPhotoUrl;
        self.addOrderModel.IdentitfyBackPhotoUrl = model.identitfyBackPhotoUrl;
        self.addOrderModel.IdentitfyCategory = model.identitfyCategory;
        self.addOrderModel.Address = model.address;
        
        NSString *customerName = [NSString stringWithFormat:@"%@%@",@"客户名称：",self.addOrderModel.CustomerName];
        NSString *customerCode = [NSString stringWithFormat:@"%@%@",@"客户编号：",self.addOrderModel.CustomerCode];
        NSString *identCatoType = [NSString stringWithFormat:@"%@%@",@"证件类型：", [NSString backTitleAccordingIdCatogaryType:[self.addOrderModel.IdentitfyCategory integerValue]]];
        NSString *identId = [NSString stringWithFormat:@"%@%@",@"证件号码：",self.addOrderModel.IdentityId];
        
        NSString *Adress = [NSString stringWithFormat:@"%@%@",@"通讯地址：",[NSString judegeIsNullAndTransform:self.addOrderModel.Address]];
        NSArray *arr = @[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："];
        [self.cellContentArray replaceObjectAtIndex:0 withObject:arr];
        [self.tableview reloadSection:0 withRowAnimation:UITableViewRowAnimationNone];
    } failure:^(NSString * _Nullable errorMessage) {
        
    }];

}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    if (!([self.theme isEqual:@"编辑订单"] || [self.theme isEqual:@"变更订单"])) {
        return;
    }
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:@"查看订单记录" forState:UIControlStateNormal];
    [btn setTitleColor:cellTextColor forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize:10];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    [btn addTarget:self action:@selector(lookAtOrderRecord:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)back{
//    [super back];
    if ([self.theme isEqual:@"再次核对订单信息"]) {
//        self.backClearBlock(self.addOrderModel);
        [self.backClearSub sendNext:self.addOrderModel];
        [self.navigationController popViewControllerAnimated:YES];
        return;
    }
    [super back];
}

/**
 查看订单记录

 */
-(void)lookAtOrderRecord:(UIButton *)btn{
    LKOrderRecordViewController *vc = [[LKOrderRecordViewController alloc] init];
    vc.orderCode = self.addOrderModel.OrderCode;
    [self.navigationController pushViewController:vc animated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.cellContentArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSArray *contentsArra = self.cellContentArray[section];
    return contentsArra.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LKWorkOrderListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailCell"];
    NSArray *array = self.cellContentArray[indexPath.section];
    if (indexPath.section != 4) {
           cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
    }else{
        
    }
    WS(weakSelf)
    switch (indexPath.section) {
        case 0:
        {
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            if (indexPath.row == 0) {
                cell.lineView.hidden = NO;
            }
            if (indexPath.row == 5 || indexPath.row == 6) {
                LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
                cell.titleLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                if (indexPath.row == 5) {
                    [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.addOrderModel.IdentitfyPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                }else{
                    [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.addOrderModel.IdentitfyBackPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                }
                return cell;
            }
        }
            break;
        case 1:
        {
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            if (indexPath.row == 0) {
                cell.arrowBtn.hidden = NO;
                cell.lineView.hidden = NO;
                cell.arrowBtn.selected = _productFlag;
            }
            
        }
            break;
        case 2:
        {
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            if (indexPath.row == 0) {
                cell.lineView.hidden = NO;
            }
        }
            break;
        case 3:
        {
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            if (indexPath.row == 0) {
                cell.arrowBtn.hidden = NO;
                cell.lineView.hidden = NO;
                cell.arrowBtn.selected = _bankFlag;
            }
            if ([array[indexPath.row] containsString:@"回款账户"]) {
                cell.arrowBtn.hidden = NO;
                cell.lineView.hidden = NO;
                cell.arrowBtn.selected = self.secondbankFlag;
            }
            if ([array[indexPath.row] containsString:@"银行卡正面复印件"]) {
                LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
                if (indexPath.row == array.count - 1) {
                    [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.addOrderModel.RepayAccountPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                }else{
                    [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.addOrderModel.PayAccountPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                }
                cell.titleLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                return cell;
            }
            
            
        }
            break;
        case 4:
        {
            YLInvestmentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YLInvestmentTableViewCell"];
            cell.model = self.cellContentArray[indexPath.section][indexPath.row];
            return cell;
        }
            break;
        case 5:
        {
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            if (indexPath.row == 0) {
                cell.lineView.hidden = NO;
            }
        }
            break;
        case 6:
        {
            cell.arrowBtn.hidden = NO;
            cell.lineView.hidden = NO;
            cell.arrowBtn.selected = NO;
            if (indexPath.row == 0) {
                if (_contractHomeFlag) {
                    static NSString *cellId = @"contracHomeId";
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
                    if (cell == nil) {
                        cell = [[[NSBundle mainBundle] loadNibNamed:@"LKWorkOrderDetailContractDetailCell" owner:self options:nil] lastObject];
                    }
                    cell.typeTitle = @"合同首页";
                    cell.addOrderModel = self.addOrderModel;
                    cell.arrorBtn.selected = YES;
                    return cell;
                }
                
            }
            if (indexPath.row == 1) {
                
                if (self.contractDetailFlag) {
                    static NSString *cellId = @"contracDetailId";
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
                    if (cell == nil) {
                        cell = [[[NSBundle mainBundle] loadNibNamed:@"LKWorkOrderDetailContractDetailCell" owner:self options:nil] lastObject];
                    }
                    cell.typeTitle = @"合同详情";
                    cell.addOrderModel = self.addOrderModel;
                    cell.arrorBtn.selected = YES;
                    return cell;
                }
            }
            if (indexPath.row == 2) {
                if (self.POSFlag) {
                    static NSString *cellId = @"contracPOSId";
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
                    if (cell == nil) {
                        cell = [[[NSBundle mainBundle] loadNibNamed:@"LKWorkOrderDetailContractDetailCell" owner:self options:nil] lastObject];
                    }
                    cell.typeTitle = @"POS凭证";
                    cell.addOrderModel = self.addOrderModel;
                    cell.arrorBtn.selected = YES;
                    return cell;
                }
            }
            if (indexPath.row == 3) {
                if (self.otherFlag) {
                    static NSString *cellId = @"contracOtherId";
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
                    if (cell == nil) {
                        cell = [[[NSBundle mainBundle] loadNibNamed:@"LKWorkOrderDetailContractDetailCell" owner:self options:nil] lastObject];
                    }
                    cell.typeTitle = @"其他";
                    cell.addOrderModel = self.addOrderModel;
                    cell.arrorBtn.selected = YES;
                    return cell;
                }
            }
            
            return cell;
            
        }
            break;
            
        default:
            break;
    }
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
        {
            if (indexPath.row == 5 || indexPath.row == 6) {
                return 90;
            }
            return 35;
        }
            break;
        case 1:
        {
            return 50;
        }
            break;
        case 2:
        {
            return 35;
        }
            break;
        case 3:
        {
            if ([self.cellContentArray[indexPath.section][indexPath.row] containsString:@"银行卡正面复印件"]) {
                return 90;
            }
            return 50;
        }
            break;
        case 4:
        {
            return 145;
        }
            break;
        case 5:
        {
            return 35;
        }
            break;
        case 6:
        {
            
            switch (indexPath.row) {
                case 0:
                {
                    if (self.contractHomeFlag) {
                        return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.addOrderModel.OrderAttachs1.count / 3 + 1)+(self.addOrderModel.OrderAttachs1.count / 3) * 10 );
                    }
                    return 50;
                }
                    break;
                case 1:
                {
                    if (self.contractDetailFlag) {
                        return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.addOrderModel.OrderAttachs2.count / 3 + 1)+(self.addOrderModel.OrderAttachs2.count / 3) * 10 );
                    }
                    return 50;
                }
                    break;
                case 2:
                {
                    if (self.POSFlag) {
                        
                        return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.addOrderModel.OrderAttachs3.count / 3 + 1)+(self.addOrderModel.OrderAttachs3.count / 3) * 10 );
                    }
                    return 50;
                }
                    break;
                case 3:
                {
                    if (self.otherFlag) {
                        return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.addOrderModel.OrderAttachs0.count / 3 + 1)+(self.addOrderModel.OrderAttachs0.count / 3) * 10 );
                    }
                    return 50;
                }
                    break;
                default:
                    break;
            }
        }
            break;
        default:
            break;
    }
    return 0;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    WS(weakSelf)
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = cellHeaderBgColor;
    UIView *headerBottomView = [[UIView alloc] init];
    headerBottomView.backgroundColor = [UIColor whiteColor];
    [headerView addSubview:headerBottomView];
    [headerBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(headerView);
        make.height.mas_equalTo(37);
    }];
    UIImageView *iconImageView = [[UIImageView alloc] init];
    iconImageView.image = [UIImage imageNamed:self.headerIconsArray[section]];
    [headerBottomView addSubview:iconImageView];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerBottomView).offset(14);
        make.centerY.equalTo(headerBottomView);
    }];
    LKBaseLabel *label = [LKBaseLabel labelWithFrame:CGRectZero text:@"" textColor:COLOR_HEX(0x565D66) font:[UIFont systemFontOfSize:15] textAlignment:NSTextAlignmentLeft backgroundColor:[UIColor whiteColor]];
    label.text = self.headerTitlsArray[section];
    [headerBottomView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconImageView.mas_right).offset(8);
        make.centerY.equalTo(iconImageView);
    }];
    UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [headerBottomView addSubview:editBtn];
    [editBtn setImage:[UIImage imageNamed:@"bianji"] forState:UIControlStateNormal];
    if ([weakSelf.theme containsString:@"变更"]) {
        if (section == 1 || section == 4 || section == 5) {
            [editBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        }else{
            [editBtn setImage:[UIImage imageNamed:@"bianji"] forState:UIControlStateNormal];
        }
    }
    if ([self.theme containsString:@"变更"] || [self.theme containsString:@"编辑"]) {
        if (section == 0) {
            [editBtn setImage:[UIImage imageNamed:@"reloadreloadreload"] forState:UIControlStateNormal];
        }
    }else{
        
    }
    if (section == 5) {
        [editBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    }

    [[editBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        switch (section) {
            case 0:
                {
                    LKAddWorkCustomViewController *vc = [[LKAddWorkCustomViewController alloc] init];
                    vc.isOrderUpdate = YES;
                    if ([weakSelf.addOrderModel.ChangeEdit integerValue] == 0) {
                        [SVProgressHUD showInfoWithStatus:@"不可改动"];
                        return ;
                    }else if ([weakSelf.addOrderModel.ChangeEdit integerValue] == 1){
                        vc.headerTitle = @"编辑";
                    }else{
                       vc.headerTitle = @"变更";
                    }
                    vc.updateType = YES;
                    vc.addOrderModel = weakSelf.addOrderModel;
                    if ([self.theme containsString:@"编辑"] || [self.theme containsString:@"变更"]) {
                        [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:orderChangeCustomeInformation header:[LKUserInforTool header] parameters:@{@"customerCode":weakSelf.addOrderModel.CustomerCode} progress:^(NSProgress * _Nullable progress) {
                            
                        } success:^(BOOL isSuccess, id  _Nullable responseObject) {
                            
                            LKCustomerModel *model = [LKCustomerModel modelWithDictionary:responseObject[@"result"]];
                            weakSelf.addOrderModel.CustomerName = model.customerName;
                            weakSelf.addOrderModel.CustomerCode = model.customerCode;
                            weakSelf.addOrderModel.IdentitfyCategory = model.identitfyCategory;
                            weakSelf.addOrderModel.IdentityId = model.identityId;
                            
//                            weakSelf.addOrderModel.Address = [NSString stringWithFormat:@"%@/%@",model.city,model.address];
                            weakSelf.addOrderModel.Address = [NSString stringWithFormat:@"%@",model.city];
                            weakSelf.addOrderModel.IdentitfyBackPhotoUrl = model.identitfyBackPhotoUrl;
                            weakSelf.addOrderModel.IdentitfyPhotoUrl = model.identitfyPhotoUrl;
                            weakSelf.addOrderModel.CustomerId = model.customerId;
                            NSString *customerName = [NSString stringWithFormat:@"%@%@",@"客户名称：",weakSelf.addOrderModel.CustomerName];
                            NSString *customerCode = [NSString stringWithFormat:@"%@%@",@"客户编号：",weakSelf.addOrderModel.CustomerCode];
                            NSString *identCatoType = [NSString stringWithFormat:@"%@%@",@"证件类型：", [NSString backTitleAccordingIdCatogaryType:[weakSelf.addOrderModel.IdentitfyCategory integerValue]]];
                            
                            NSString *identId = [NSString stringWithFormat:@"%@%@",@"证件号码：",weakSelf.addOrderModel.IdentityId];
                            
                            NSString *Adress = [NSString stringWithFormat:@"%@%@",@"通讯地址：",[NSString judegeIsNullAndTransform:weakSelf.addOrderModel.Address]];
                            if ([weakSelf.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
                                if ([weakSelf.addOrderModel.CusIsAuthenticated boolValue]) {
                                                        [weakSelf.cellContentArray replaceObjectAtIndex:0 withObject:@[customerName,customerCode,identCatoType,identId,Adress]];
                                }else{
                                                                    [weakSelf.cellContentArray replaceObjectAtIndex:0 withObject:@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："]];
                                }

                            }else{
                                [weakSelf.cellContentArray replaceObjectAtIndex:0 withObject:@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："]];
                            }

                            [weakSelf.tableview reloadSection:0 withRowAnimation:UITableViewRowAnimationNone];
                            return ;
                        } failure:^(NSString * _Nullable errorMessage) {
                            
                        }];
                        return;
                    }
                    [weakSelf.navigationController pushViewController:vc animated:YES];
                }
                break;
            case 1:
            {
                if ([weakSelf.theme containsString:@"变更"]) {
                    return ;
                }
                LKChooseProductDetailViewController *vc = [[LKChooseProductDetailViewController alloc] init];
                vc.IsAddOrder = YES;
                vc.isOrderUpdate = YES;
                vc.identId = weakSelf.addOrderModel.IdentityId;
                vc.customeId = weakSelf.addOrderModel.CustomerId;
                WS(weakSelf)
                vc.productmodelBlock = ^(LKProductModel *model) {
                    weakSelf.addOrderModel.ProductName = model.productName;
                    weakSelf.addOrderModel.ProductCode = model.productCode;
                    weakSelf.addOrderModel.ProductTerm = model.productTerm;
                    weakSelf.addOrderModel.ProductCategory = model.productCategory;
                    weakSelf.addOrderModel.ProductAnnualizedYield = model.annualizedYield;
                    weakSelf.addOrderModel.LeastMoney = model.leastMoney;
                    weakSelf.addOrderModel.PayCategory = model.payCategory;
                    weakSelf.addOrderModel.IncreaseRadix = model.increaseRadix;
                    NSString *productName = [NSString stringWithFormat:@"%@%@",@"产品名称：",weakSelf.addOrderModel.ProductName];
                    [weakSelf.cellContentArray replaceObjectAtIndex:1 withObject:@[productName]];
                    [weakSelf.tableview reloadSection:1 withRowAnimation:UITableViewRowAnimationNone];
                };
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }
                break;
            case 2:
            {
//                if ([weakSelf.theme containsString:@"变更"]) {
//                    editBtn.hidden = YES;
//                    return ;
//                }
                LKAddProtocalMessageViewController *vc = [[LKAddProtocalMessageViewController alloc] init];
                vc.isUpdateOrder = YES;
                vc.addOrderModel = weakSelf.addOrderModel;
                vc.customermodel = weakSelf.model;
                vc.isReloadUpdate = @"damn";
                vc.addOrderModel.EndEntityDate = nil;
                vc.addOrderModel.EndEntityDateTest = nil;
                if ([weakSelf.theme containsString:@"变更"]) {
                    vc.isOrderBianGeng = @"fuck";
                }
//                NSString *endTime = [weakSelf.addOrderModel.EndEntityDateTest mutableCopy];
//                NSString *caculaTest = [weakSelf.addOrderModel.CalulationDate mutableCopy];
                vc.sendAddOrderBlock = ^(LKAddOrderModel *addOrderModel) {

                    weakSelf.addOrderModel = addOrderModel;
//                    weakSelf.addOrderModel.EndEntityDateTest = endTime;
//                    weakSelf.addOrderModel.CalulationDate = caculaTest;
                    NSString *contractCode = [NSString stringWithFormat:@"%@%@",@"合同编号：",weakSelf.addOrderModel.ContractCode];
                    NSString *investMoney = [NSString stringWithFormat:@"%@%@",@"投资金额：",weakSelf.addOrderModel.InvestmentAmount];
                    NSString *qixiDate = [NSString stringWithFormat:@"%@%@",@"起息日期：",weakSelf.addOrderModel.CalulationDate];
                    
                    NSString *daoqiDate = [NSString stringWithFormat:@"%@%@",@"到期日期：",weakSelf.addOrderModel.EndEntityDateTest];
                    NSString *payType = [NSString stringWithFormat:@"%@%@",@"支付方式：",[weakSelf accordingPayType:[weakSelf.addOrderModel.PaymentCategory integerValue]]];
                    NSString *tradeCode = [NSString stringWithFormat:@"%@%@",@"交易参考号：",weakSelf.addOrderModel.TransactionReferenceNumber];
                    NSString *posCode = [NSString stringWithFormat:@"%@%@",@"POS机终端号：",weakSelf.addOrderModel.PosCode];
                    NSString *suppelment = [NSString stringWithFormat:@"%@%@",@"附加说明：",weakSelf.addOrderModel.Supplement];
                    NSString *fujialilv = [NSString stringWithFormat:@"附加利率：%@",self.addOrderModel.AdditionalInterestRate];
                    weakSelf.productFlag = NO;
                [weakSelf.cellContentArray replaceObjectAtIndex:2 withObject:@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment]];
                    [weakSelf.tableview reloadSection:2 withRowAnimation:UITableViewRowAnimationNone];
                };
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }
                break;
            case 3:
            {
//                if ([weakSelf.theme containsString:@"变更"]) {
//                    [SVProgressHUD showInfoWithStatus:@"变更订单无法修改此选项"];
//                    return ;
//                }
                LKChooseBankCardViewController *vc = [[LKChooseBankCardViewController alloc] init];
                vc.customermodel = self.model;
                vc.addOrderModel = self.addOrderModel;
                vc.isOrderUpdate = YES;
                if ([weakSelf.theme containsString:@"变更"]) {
                    vc.isOrderBianGeng = @"fuck";
                }
//                vc.isOrderBianGeng = @"变更";
                
                vc.sendAddOrderModel = ^(LKAddOrderModel *addOrderModel) {
                    weakSelf.addOrderModel = addOrderModel;
                    //回款账户
                    NSString *repayAccountCode = [NSString stringWithFormat:@"%@%@",@"回款账户卡号：",weakSelf.addOrderModel.RepayAccountCode];
                    //付款账户
                    NSString *payAccountCode = [NSString stringWithFormat:@"%@%@",@"划扣账户卡号：",weakSelf.addOrderModel.PayAccountCode];
                    weakSelf.bankFlag = NO;
                    weakSelf.secondbankFlag = NO;
                    [weakSelf.cellContentArray replaceObjectAtIndex:3 withObject:@[payAccountCode,repayAccountCode]];
                    [weakSelf.tableview reloadSection:3 withRowAnimation:UITableViewRowAnimationNone];
                };
                [weakSelf.navigationController pushViewController:vc animated:YES];
                
            }
                break;
            case 4:
            {
                if ([weakSelf.theme containsString:@"变更"]) {
                    return ;
                }
                LKDiscountTicketViewController *vc = [[LKDiscountTicketViewController alloc] init];
                vc.isOrderUpdate = YES;
                vc.addOrderModel = weakSelf.addOrderModel;
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }
                break;
            case 5:
            {
                if ([weakSelf.theme containsString:@"变更"]) {
                    return ;
                }
            }
                break;
            case 6:
            {
                LKUploadFileViewController *vc = [[LKUploadFileViewController alloc] init];
                vc.addOrderModel = weakSelf.addOrderModel;
                vc.isOrderUpdate = YES;
                vc.sendAddOrderBlock = ^(LKAddOrderModel *addOrderModel) {
                    weakSelf.addOrderModel = addOrderModel;
                    weakSelf.POSFlag = NO;
                    weakSelf.contractHomeFlag = NO;
                    weakSelf.contractDetailFlag = NO;
                    weakSelf.otherFlag = NO;
                    [weakSelf.tableview reloadSection:6 withRowAnimation:UITableViewRowAnimationNone];
                };
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }
                break;
            default:
                break;
        }
    }];
    [editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(headerBottomView.mas_right).offset(-14);
        make.centerY.equalTo(headerBottomView);
    }];
    return headerView;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = cellHeaderBgColor;
    return footerView;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return section == 0 ? 98:37;
    return 37;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
//    return section == self.headerTitlsArray.count - 1?100: 16;
    return 16;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSArray *array = self.cellContentArray[indexPath.section];
    if ([self.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
        switch (indexPath.section) {
            case 0:
            {
                
            }
                break;
            case 1:
            {
                if (indexPath.row == 0) {
                    LKWorkOrderListDetailCell *cell = [tableView cellForRowAtIndexPath:indexPath];
                    self.productFlag = !self.productFlag;
                    cell.arrowBtn.selected = self.productFlag;
                    //产品信息
                    
                    NSString *productName = [NSString stringWithFormat:@"%@%@",@"产品名称：",self.addOrderModel.ProductName];
                    if (self.productFlag) {
                        NSString *productCode = [NSString stringWithFormat:@"%@%@",@"产品编号：",self.addOrderModel.ProductCode];
                        
                        NSString *productType = [NSString stringWithFormat:@"%@%@",@"产品类型：",[NSString backProductTypeAccordingStatusType:[self.addOrderModel.ProductCategory integerValue]]];
                        NSString *productTerm = [NSString stringWithFormat:@"%@%@",@"产品期限：",self.addOrderModel.ProductTerm];
                        NSString *productDuiHuan = [NSString stringWithFormat:@"%@%@",@"兑换方式：",[self accordingDuiFuFangshiType:[self.addOrderModel.PayCategory integerValue]]];
                        NSString *yearShouyi = [NSString stringWithFormat:@"%@%@",@"年化收益：",self.addOrderModel.ProductAnnualizedYield];
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[productName,productCode,productType,productTerm,productDuiHuan,yearShouyi]];
                    }else{
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[productName]];
                    }
                    
                    [tableView reloadSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
                }
                
            }
                break;
            case 2:
            {
                
            }
                break;
            case 3:
            {
                LKWorkOrderListDetailCell *cell = [tableView cellForRowAtIndexPath:indexPath];
                
                //回款账户
                NSString *repayAccountCode = [NSString stringWithFormat:@"%@%@",@"回款账户卡号：",self.addOrderModel.RepayAccountCode];
                NSString *repayAccountName = [NSString stringWithFormat:@"%@%@",@"用户名：",self.addOrderModel.RepayAccountName];
                
                NSString *repayBankName = [NSString stringWithFormat:@"%@%@",@"开户行：",self.addOrderModel.RepayBankName];
                NSString *repayBankBranch = [NSString stringWithFormat:@"%@%@",@"开户行支行：",self.addOrderModel.RepayBankBranch];
                NSString *repayBankCity = [NSString stringWithFormat:@"%@%@",@"开户行支行省市：",self.addOrderModel.RepayBankCity];
                NSString *repayBankImageUrl = [NSString stringWithFormat:@"%@%@",@"银行卡正面复印件：",self.addOrderModel.RepayAccountPhotoUrl];
                //划扣账户
                NSString *payAccountCode = [NSString stringWithFormat:@"%@%@",@"划扣账户卡号：",self.addOrderModel.PayAccountCode];
                NSString *payAccountName = [NSString stringWithFormat:@"%@%@",@"用户名：",self.addOrderModel.PayAccountName];
                NSString *payBankName = [NSString stringWithFormat:@"%@%@",@"开户行：",self.addOrderModel.PayBankName];
                NSString *payBankBranch = [NSString stringWithFormat:@"%@%@",@"开户行支行：",self.addOrderModel.PayBankBranch];
                NSString *payBankCity = [NSString stringWithFormat:@"%@%@",@"开户行支行省市：",self.addOrderModel.PayBankCity];
                
                NSString *payBankImageUrl  = [NSString stringWithFormat:@"%@%@",@"银行卡正面复印件：",self.addOrderModel.PayAccountPhotoUrl];
                if (cell.arrowBtn.hidden == NO) {
                    if (indexPath.row == 0) {
                        self.bankFlag = !self.bankFlag;
                        cell.arrowBtn.selected = self.bankFlag;
                    }else{
                        self.secondbankFlag = !self.secondbankFlag;
                        cell.arrowBtn.selected = self.secondbankFlag;
                        
                    }
                    if (self.secondbankFlag && self.bankFlag) {
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,payAccountName,payBankName,payBankBranch,payBankCity,repayAccountCode,repayAccountName,repayBankName,repayBankBranch,repayBankCity]];
                    }else if(self.secondbankFlag && !self.bankFlag){
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,repayAccountCode,repayAccountName,repayBankName,repayBankBranch,repayBankCity]];
                    }else if (!self.secondbankFlag && self.bankFlag){
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,payAccountName,payBankName,payBankBranch,payBankCity,repayAccountCode]];
                    }else{
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,repayAccountCode]];
                    }
                    [tableView reloadSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
                }
                
                
            }
                break;
            case 4:
            {
                
            }
                break;
            case 5:
            {
                
            }
                break;
            case 6:
            {
                if (indexPath.row == 0) {
                    self.contractHomeFlag = !self.contractHomeFlag;
                }else if (indexPath.row == 1){
                    self.contractDetailFlag = !self.contractDetailFlag;
                }else if (indexPath.row == 2){
                    self.POSFlag = !self.POSFlag;
                }else{
                    self.otherFlag = !self.otherFlag;
                }
                [self.tableview reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationNone];
            }
                break;
            default:
                break;
        }
    }else{
        switch (indexPath.section) {
            case 0:
            {
                
            }
                break;
            case 1:
            {
                if (indexPath.row == 0) {
                    LKWorkOrderListDetailCell *cell = [tableView cellForRowAtIndexPath:indexPath];
                    self.productFlag = !self.productFlag;
                    cell.arrowBtn.selected = self.productFlag;
                    //产品信息
                    
                    NSString *productName = [NSString stringWithFormat:@"%@%@",@"产品名称：",self.addOrderModel.ProductName];
                    if (self.productFlag) {
                        NSString *productCode = [NSString stringWithFormat:@"%@%@",@"产品编号：",self.addOrderModel.ProductCode];
                        
                        NSString *productType = [NSString stringWithFormat:@"%@%@",@"产品类型：",[NSString backProductTypeAccordingStatusType:[self.addOrderModel.ProductCategory integerValue]]];
                        NSString *productTerm = [NSString stringWithFormat:@"%@%@",@"产品期限：",self.addOrderModel.ProductTerm];
                        NSString *productDuiHuan = [NSString stringWithFormat:@"%@%@",@"兑换方式：",[self accordingDuiFuFangshiType:[self.addOrderModel.PayCategory integerValue]]];
                        NSString *yearShouyi = [NSString stringWithFormat:@"%@%@",@"年化收益：",self.addOrderModel.ProductAnnualizedYield];
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[productName,productCode,productType,productTerm,productDuiHuan,yearShouyi]];
                    }else{
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[productName]];
                    }
                    
                    [tableView reloadSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
                }
                
            }
                break;
            case 2:
            {
                
            }
                break;
            case 3:
            {
                LKWorkOrderListDetailCell *cell = [tableView cellForRowAtIndexPath:indexPath];
                
                //回款账户
                NSString *repayAccountCode = [NSString stringWithFormat:@"%@%@",@"回款账户卡号：",self.addOrderModel.RepayAccountCode];
                NSString *repayAccountName = [NSString stringWithFormat:@"%@%@",@"用户名：",self.addOrderModel.RepayAccountName];
                
                NSString *repayBankName = [NSString stringWithFormat:@"%@%@",@"开户行：",self.addOrderModel.RepayBankName];
                NSString *repayBankBranch = [NSString stringWithFormat:@"%@%@",@"开户行支行：",self.addOrderModel.RepayBankBranch];
                NSString *repayBankCity = [NSString stringWithFormat:@"%@%@",@"开户行支行省市：",self.addOrderModel.RepayBankCity];
                NSString *repayBankImageUrl = [NSString stringWithFormat:@"%@%@",@"银行卡正面复印件：",self.addOrderModel.RepayAccountPhotoUrl];
                //划扣账户
                NSString *payAccountCode = [NSString stringWithFormat:@"%@%@",@"划扣账户卡号：",self.addOrderModel.PayAccountCode];
                NSString *payAccountName = [NSString stringWithFormat:@"%@%@",@"用户名：",self.addOrderModel.PayAccountName];
                NSString *payBankName = [NSString stringWithFormat:@"%@%@",@"开户行：",self.addOrderModel.PayBankName];
                NSString *payBankBranch = [NSString stringWithFormat:@"%@%@",@"开户行支行：",self.addOrderModel.PayBankBranch];
                NSString *payBankCity = [NSString stringWithFormat:@"%@%@",@"开户行支行省市：",self.addOrderModel.PayBankCity];
                
                NSString *payBankImageUrl  = [NSString stringWithFormat:@"%@%@",@"银行卡正面复印件：",self.addOrderModel.PayAccountPhotoUrl];
                if (cell.arrowBtn.hidden == NO) {
                    if (indexPath.row == 0) {
                        self.bankFlag = !self.bankFlag;
                        cell.arrowBtn.selected = self.bankFlag;
                    }else{
                        self.secondbankFlag = !self.secondbankFlag;
                        cell.arrowBtn.selected = self.secondbankFlag;
                        
                    }
                    if (self.secondbankFlag && self.bankFlag) {
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,payAccountName,payBankName,payBankBranch,payBankCity,@"银行卡正面复印件：",repayAccountCode,repayAccountName,repayBankName,repayBankBranch,repayBankCity,@"银行卡正面复印件："]];
                    }else if(self.secondbankFlag && !self.bankFlag){
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,repayAccountCode,repayAccountName,repayBankName,repayBankBranch,repayBankCity,@"银行卡正面复印件："]];
                    }else if (!self.secondbankFlag && self.bankFlag){
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,payAccountName,payBankName,payBankBranch,payBankCity,@"银行卡正面复印件：",repayAccountCode]];
                    }else{
                        [_cellContentArray replaceObjectAtIndex:indexPath.section withObject:@[payAccountCode,repayAccountCode]];
                    }
                    [tableView reloadSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
                }
                
                
            }
                break;
            case 4:
            {
                
            }
                break;
            case 5:
            {
                
            }
                break;
            case 6:
            {
                if (indexPath.row == 0) {
                    self.contractHomeFlag = !self.contractHomeFlag;
                }else if (indexPath.row == 1){
                    self.contractDetailFlag = !self.contractDetailFlag;
                }else if (indexPath.row == 2){
                    self.POSFlag = !self.POSFlag;
                }else{
                    self.otherFlag = !self.otherFlag;
                }
                [self.tableview reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationNone];
            }
                break;
            default:
                break;
        }
    }

}

-(NSArray *)headerTitlsArray{
    if (!_headerTitlsArray) {
        _headerTitlsArray = @[@"客户信息",@"产品信息",@"协议信息",@"银行信息",@"优惠券",@"订单来源",@"附件信息"];
    }
    return _headerTitlsArray;
}
-(NSArray *)headerIconsArray{
    if (!_headerIconsArray) {
        _headerIconsArray = @[@"kehuxinxi",@"kehuxinxi",@"xieyixinxi",@"yinhangxinxi",@"youhuiquan",@"dingdanaiyuan",@"fujian"];
    }
    return _headerIconsArray;
}
-(NSMutableArray *)cellContentArray{
    if (!_cellContentArray) {
        _cellContentArray = [[NSMutableArray alloc] init];
    }
    return _cellContentArray;
}
-(void)setAddOrderAllInformationWith{
    NSString *customerName = [NSString stringWithFormat:@"%@%@",@"客户名称：",self.addOrderModel.CustomerName];
    NSString *customerCode = [NSString stringWithFormat:@"%@%@",@"客户编号：",self.addOrderModel.CustomerCode];
    NSString *identCatoType = [NSString stringWithFormat:@"%@%@",@"证件类型：",[NSString backTitleAccordingIdCatogaryType:[self.addOrderModel.IdentitfyCategory integerValue]]];
    NSString *identId = [NSString stringWithFormat:@"%@%@",@"证件号码：",self.addOrderModel.IdentityId];
    NSString *Adress = [NSString stringWithFormat:@"%@%@",@"通讯地址：",[NSString judegeIsNullAndTransform:self.addOrderModel.Address]];
    //订单来源信息
    NSString *orderOwner = [NSString stringWithFormat:@"%@%@",@"订单所属人：",self.addOrderModel.OwnerName];
    NSString *areaZong = [NSString stringWithFormat:@"%@%@",@"所属区总：",self.addOrderModel.Area];
    NSString *fenZong = [NSString stringWithFormat:@"%@%@",@"所属分总：",self.addOrderModel.BranchCompany];
    NSString *laoZong = [NSString stringWithFormat:@"%@%@",@"所属总监：",self.addOrderModel.SalesDepartment];
    NSString *director = [NSString stringWithFormat:@"%@%@",@"所属主管：",[NSString judegeIsNullAndTransform:self.addOrderModel.Director]];
    
    //协议信息
    NSString *contractCode = [NSString stringWithFormat:@"%@%@",@"合同编号：",self.addOrderModel.ContractCode];
    NSString *investMoney = [NSString stringWithFormat:@"%@%@",@"投资金额：",self.addOrderModel.InvestmentAmount];
    NSString *qixiDate = [NSString stringWithFormat:@"%@%@",@"起息日期：",self.addOrderModel.CalulationDate];
    
    NSString *daoqiDate = [NSString stringWithFormat:@"%@%@",@"到期日期：",[NSString judegeIsNullAndTransform:self.addOrderModel.EndEntityDate]];
    NSString *payType = [NSString stringWithFormat:@"%@%@",@"支付方式：",[self accordingPayType:[self.addOrderModel.PaymentCategory integerValue]]];
    NSString *tradeCode = [NSString stringWithFormat:@"%@%@",@"交易参考号：",self.addOrderModel.TransactionReferenceNumber];
    NSString *posCode = [NSString stringWithFormat:@"%@%@",@"POS机终端号：",self.addOrderModel.PosCode];
    NSString *suppelment = [NSString stringWithFormat:@"%@%@",@"附加说明：",self.addOrderModel.Supplement];
    NSString *fujialilv = [NSString stringWithFormat:@"附加利率：%@",self.addOrderModel.AdditionalInterestRate];
    //产品信息
    NSString *productName = [NSString stringWithFormat:@"%@%@",@"产品名称：",self.addOrderModel.ProductName];
    //银行卡信息
    //回款账户
    NSString *repayAccountCode = [NSString stringWithFormat:@"%@%@",@"回款账户卡号：",self.addOrderModel.RepayAccountCode];
    //回款账户
    NSString *payAccountCode = [NSString stringWithFormat:@"%@%@",@"划扣账户卡号：",self.addOrderModel.PayAccountCode];
    NSMutableArray *voucherArra = [[NSMutableArray alloc] init];
    for (NSDictionary *dic in self.addOrderModel.OrderVoucher) {
        YLInvestmentCertificateModel *model = [YLInvestmentCertificateModel modelWithDictionary:dic];
        [voucherArra addObject:model];
    }

    if ([self.addOrderModel.IsContinuedInvestment integerValue]) {
        NSString *previesCode = [NSString stringWithFormat:@"原合同编号：%@",self.addOrderModel.PreviousContractCode];
        NSString *previesMoney = [NSString stringWithFormat:@"原合同金额：%@",self.addOrderModel.PreviousOrderInvestmentAmount];
        NSString *conitnueInvestMoney = [NSString stringWithFormat:@"追加金额：%@",self.addOrderModel.ContinueInvestmentAmount];
        if ([self.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
                        self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress],@[productName],@[previesCode,contractCode,previesMoney,conitnueInvestMoney,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
        }else{
            self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[previesCode,contractCode,previesMoney,conitnueInvestMoney,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
        }

    }else{
        if ([self.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
           self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress],@[productName],@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
        }else{
            self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
        }

    }
    [self.tableview reloadData];
}
/**
 根据支付方式类型返回支付方式
 
 @param type 类型
 @return 支付方式
 */
-(NSString *)accordingPayType:(NSInteger)type{
    if (type == 1) {
        return @"POS终端";
    }else{
        return @"转账";
    }
}

/**
 根据兑付方式返回兑付类型
 
 @param type 兑付方式
 @return 兑付类型
 */
-(NSString *)accordingDuiFuFangshiType:(NSInteger)type{
    if (type == 0) {
        return @"到期分配";
    }else if(type == 1){
        return @"按月分配";
    }
    return @"半年分配";
}

/**
 提交订单信息
 */
-(void)submitOrderInformationWithbtn:(UIButton *)btn{
    if ([self.theme containsString:@"变更"]) {
        if (!self.uploadBgView) {
            self.uploadBgView = [[UIView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, WIDTH, HEIGHT - NAVIGATION_BAR_HEIGHT)];
            self.uploadBgView.backgroundColor = [UIColor lightGrayColor];
            [self.view addSubview:self.uploadBgView];
            [self.view bringSubviewToFront:self.uploadBgView];
            self.uploadChangeFileView = [[LKUpLoadChangeFileView alloc] initWithFrame:CGRectMake(10, NAVIGATION_BAR_HEIGHT + 30, WIDTH - 20, HEIGHT/3 * 2)];
            self.uploadChangeFileView.backgroundColor = [UIColor whiteColor];
            [self.uploadBgView addSubview:self.uploadChangeFileView];
            UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
            [cancelBtn addTarget:self action:@selector(dismissTheUpLoadBgView:) forControlEvents:UIControlEventTouchUpInside];
            [self.uploadBgView addSubview:cancelBtn];
            [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(self.uploadChangeFileView.mas_right);
                make.bottom.equalTo(self.uploadChangeFileView.mas_top).offset(-5);
                make.size.mas_equalTo(CGSizeMake(20, 20));
            }];
            [cancelBtn setImage:[UIImage imageNamed:@"shibai"] forState:UIControlStateNormal];
            [self.uploadChangeFileView.upBtn addTarget:self action:@selector(uploadChangeFileAction:) forControlEvents:UIControlEventTouchUpInside];
        }else{
            [self.view addSubview:self.uploadBgView];
            [self.view bringSubviewToFront:self.uploadBgView];
        }
        
    }
    if (self.updateId) {
        if ([self.theme containsString:@"变更"]) {
            if (self.waitSignal) {
                return;
            }else{
                [self.uploadBgView removeFromSuperview];
            }
        }else{
            self.waitSignal = NO;
        }
    }else{
        self.waitSignal = NO;
    }

    NSMutableDictionary *updateParam = [[NSMutableDictionary alloc] init];
    NSString *chooseUrl = addOrderUrl;
    if (self.updateId) {
        if ([btn.titleLabel.text isEqual:@"保存"]) {
            self.addOrderModel.ApprovalStatus = @"0";
        }else{
            self.addOrderModel.ApprovalStatus = @"1";
            
        }
        self.addOrderModel.CalulationDate = [[self.addOrderModel.CalulationDate componentsSeparatedByString:@"T"] firstObject];
        self.addOrderModel.CalulationDateTest = nil;
        NSDictionary *updateDic = [NSDictionary dictionaryWithObjectsAndKeys:self.updateId,@"Id", nil];
        if ([self.theme isEqual:@"变更订单"]) {
            chooseUrl = updateOrderUlr;
            if (self.orderAttachsChangeArray.count > 0) {
                if ([btn.titleLabel.text isEqual:@"保存"]) {
                    self.addOrderModel.ApprovalStatus = @"-6";
                }else{
                    self.addOrderModel.ApprovalStatus = @"6";
                    
                }
                NSDictionary *param = [NSDictionary dictionaryWithObjectsAndKeys:self.orderAttachsChangeArray,@"OrderAttachsChange", nil];
                [updateParam addEntriesFromDictionary:param];
            }else{
                [SVProgressHUD showInfoWithStatus:@"请选择变更附件"];
                return;
            }
        }else{
            chooseUrl = editOrderUrl;
        }
        [updateParam addEntriesFromDictionary:updateDic];
    }else{
        if ([btn.titleLabel.text isEqual:@"保存"]) {
            self.addOrderModel.ApprovalStatus = @"0";
        }else{
            self.addOrderModel.ApprovalStatus = @"1";
        }
        
    }
    
    self.addOrderModel.OrderCode = self.addOrderModel.OrderCode == nil ? @"未生成编号":self.addOrderModel.OrderCode;
    NSDictionary *param = [self.addOrderModel properties_aps];
    [updateParam addEntriesFromDictionary:param];
    NSMutableArray *vocuherArra = [[NSMutableArray alloc] init];
    for (NSDictionary *dic in self.addOrderModel.OrderVoucher) {
        
    }
    
    BOOL isContinu = [self.addOrderModel.IsContinuedInvestment boolValue];
    [updateParam removeObjectForKey:@"IsContinuedInvestment"];
    NSDictionary *dicsss = @{@"IsContinuedInvestment":@(isContinu)};
    if (isContinu) {
        NSString *previeousOrderCode = self.addOrderModel.PreviousOrderCode == nil ? @"":self.addOrderModel.PreviousOrderCode;
        NSDictionary *judes = @{@"PreviousOrderCode":previeousOrderCode};
        [updateParam addEntriesFromDictionary:judes];
    }
    [updateParam addEntriesFromDictionary:dicsss];
    NSString *converStr = [NSString convertToJsonData:updateParam];
    [SVProgressHUD showWithStatus:@"提交中..."];
    [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:chooseUrl header:[LKUserInforTool header] parameters:updateParam progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        [SVProgressHUD dismiss];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"AddOrderUpateNotice" object:nil];
        
        [[NSNotificationCenter defaultCenter] postNotificationName:@"addOrderSpecialNotice" object:nil];
        [self.navigationController popToRootViewControllerAnimated:YES];
        
    } failure:^(NSString * _Nullable errorMessage) {
//        [SVProgressHUD showInfoWithStatus:errorMessage];
    }];
}
/**
 获取想要编辑或者变更的订单的详细信息
 */

-(void)getOrderDetailInformaiton{
    NSString *chooseUrl;
    if ([self.theme containsString:@"变更"]) {
        chooseUrl = orderUpDateDetailUrl;
    }else{
        chooseUrl = orderEditDetailUrl;
    }
    [SVProgressHUD showWithStatus:@"数据加载中..."];
    [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:chooseUrl header:[LKUserInforTool header] parameters:@{@"Id":_updateId} progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        [SVProgressHUD dismiss];
        LKOrderModel *model = [LKOrderModel modelWithDictionary:responseObject[@"result"]];
        NSDictionary *mutableDic = [model properties_aps];
        NSArray *keysValue = [mutableDic allKeys];
        NSMutableDictionary *newSetDic = [NSMutableDictionary dictionary];
        for (NSInteger i = 0; i < keysValue.count; i++) {
            NSString *key = keysValue[i];
            NSLog(@"键%@",key);
            NSString *value = [mutableDic objectForKey:key];
            NSLog(@"值%@",value);
            char headTitle = [key characterAtIndex:0] - 32;
            NSRange range = NSMakeRange(0, 1);
            key = [key stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",headTitle]];
            NSDictionary *newDic = [NSDictionary dictionaryWithObject:value forKey:key];
            [newSetDic addEntriesFromDictionary:newDic];
        }
        NSLog(@"最新键值对%@",newSetDic);
        _addOrderModel = [LKAddOrderModel modelWithDictionary:newSetDic];
        _addOrderModel.EndEntityDate = _addOrderModel.EndEntityDateTest;
        NSString *customerName = [NSString stringWithFormat:@"%@%@",@"客户名称：",self.addOrderModel.CustomerName];
        NSString *customerCode = [NSString stringWithFormat:@"%@%@",@"客户编号：",self.addOrderModel.CustomerCode];
        NSString *identCatoType = [NSString stringWithFormat:@"%@%@",@"证件类型：", [NSString backTitleAccordingIdCatogaryType:[self.addOrderModel.IdentitfyCategory integerValue]]];
       
        NSString *identId = [NSString stringWithFormat:@"%@%@",@"证件号码：",self.addOrderModel.IdentityId];
        NSString *Adress = [NSString stringWithFormat:@"%@%@",@"通讯地址：",[NSString judegeIsNullAndTransform:self.addOrderModel.Address]];
        
        //订单来源信息
        NSString *orderOwner = [NSString stringWithFormat:@"%@%@",@"订单所属人：",self.addOrderModel.OwnerName];
        NSString *areaZongStr = self.addOrderModel.Area == nil ? @"":self.addOrderModel.Area;
        NSString *areaZong = [NSString stringWithFormat:@"%@%@",@"所属区总：",areaZongStr];
        NSString *fenZong = [NSString stringWithFormat:@"%@%@",@"所属分总：",self.addOrderModel.BranchCompany];
        
        NSString *laoZong = [NSString stringWithFormat:@"%@%@",@"所属总监：",[NSString judegeIsNullAndTransform:self.addOrderModel.SalesDepartment]];
        NSString *director = [NSString stringWithFormat:@"%@%@",@"所属主管：",[NSString judegeIsNullAndTransform:self.addOrderModel.Director]];
        
        //协议信息
        NSString *contractCode = [NSString stringWithFormat:@"%@%@",@"合同编号：",self.addOrderModel.ContractCode];
        NSString *investMoney = [NSString stringWithFormat:@"%@%@",@"投资金额：",self.addOrderModel.InvestmentAmount];
        
        NSString *qixiDate = [NSString stringWithFormat:@"%@%@",@"起息日期：",[[self.addOrderModel.CalulationDate componentsSeparatedByString:@"T"] firstObject]];

        
        NSString *daoqiDate;
        if ([self.theme containsString:@"变更"]) {
            
            NSString *expiryDateT = model.expiryDateS == nil ? @"":model.expiryDateS;
            daoqiDate = [NSString stringWithFormat:@"%@%@",@"到期日期：",expiryDateT];
            
        }else{
            NSString *expiryDateT = model.endEntityDateTest == nil ? @"":model.endEntityDateTest;
           daoqiDate = [NSString stringWithFormat:@"%@%@",@"到期日期：",expiryDateT];
        }
        NSString *payType = [NSString stringWithFormat:@"%@%@",@"支付方式：",[self accordingPayType:[self.addOrderModel.PaymentCategory integerValue]]];
        NSString *tradeCode = [NSString stringWithFormat:@"%@%@",@"交易参考号：",self.addOrderModel.TransactionReferenceNumber];
        NSString *posCode = [NSString stringWithFormat:@"%@%@",@"POS机终端号：",self.addOrderModel.PosCode];
        NSString *suppelmentStr = self.addOrderModel.Supplement == nil ? @"":self.addOrderModel.Supplement;
        NSString *suppelment = [NSString stringWithFormat:@"%@%@",@"附加说明：",suppelmentStr];
        NSString *fujialilv = [NSString stringWithFormat:@"附加利率：%@",self.addOrderModel.AdditionalInterestRate];
        //产品信息
        NSString *productName = [NSString stringWithFormat:@"%@%@",@"产品名称：",self.addOrderModel.ProductName];
        //银行卡信息
        //回款账户
        NSString *repayAccountCode = [NSString stringWithFormat:@"%@%@",@"回款账户卡号：",self.addOrderModel.RepayAccountCode];
        //付款账户
        NSString *payAccountCode = [NSString stringWithFormat:@"%@%@",@"划扣账户卡号：",self.addOrderModel.PayAccountCode];
        NSMutableArray *voucherArra = [[NSMutableArray alloc] init];
        for (NSDictionary *dic in self.addOrderModel.OrderVoucher) {
            YLInvestmentCertificateModel *model = [YLInvestmentCertificateModel modelWithDictionary:dic];
            [voucherArra addObject:model];
        }
        if ([model.isContinuedInvestment integerValue]) {
            NSString *previesCode = [NSString stringWithFormat:@"原合同编号：%@",self.addOrderModel.PreviousContractCode];
            NSString *previesMoney = [NSString stringWithFormat:@"原合同金额：%@",self.addOrderModel.PreviousOrderInvestmentAmount];
            NSString *conitnueInvestMoney = [NSString stringWithFormat:@"追加金额：%@",self.addOrderModel.ContinueInvestmentAmount];
            if ([self.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
                if ([self.addOrderModel.CusIsAuthenticated boolValue]) {
                    self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress],@[productName],@[previesCode,contractCode,previesMoney,conitnueInvestMoney,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
                }else{
                    self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[previesCode,contractCode,previesMoney,conitnueInvestMoney,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
                }

            }else{
                    self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[previesCode,contractCode,previesMoney,conitnueInvestMoney,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
            }

        }else{
            if ([self.addOrderModel.IdentitfyCategory isEqual:@"1"]) {
                if ([self.addOrderModel.CusIsAuthenticated boolValue]) {
                   self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress],@[productName],@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
                }else{
                    self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
                }

            }else{
                self.cellContentArray = [NSMutableArray arrayWithArray:@[@[customerName,customerCode,identCatoType,identId,Adress,@"证件正面：",@"证件背面："],@[productName],@[contractCode,investMoney,fujialilv,qixiDate,daoqiDate,payType,tradeCode,posCode,suppelment],@[payAccountCode,repayAccountCode],@[],@[orderOwner,director,laoZong,fenZong,areaZong],@[@"合同首页",@"合同详情",@"POS凭证",@"其他"]]];
            }

        }

        [self modelZHuanHuan];
        [self.tableview reloadData];
    } failure:^(NSString * _Nullable errorMessage) {
        
    }];
}

/**
 LKAttachModel转化为字典
 */
-(void)modelZHuanHuan{
    for (LKAttachModel *attchModel in self.addOrderModel.OrderAttachs0) {
        NSDictionary *param = @{@"AttachName":attchModel.attachName,@"AttachUrl":attchModel.attachUrl,@"OrderAttachCategory":attchModel.orderAttachCategory,@"Suffix":attchModel.suffix,@"Id":attchModel.attachId};
        [self.OrderAttachsModel0 addObject:param];
    }
    self.addOrderModel.OrderAttachs0 = self.OrderAttachsModel0;
    for (LKAttachModel *attchModel in self.addOrderModel.OrderAttachs1) {
        NSDictionary *param = @{@"AttachName":attchModel.attachName,@"AttachUrl":attchModel.attachUrl,@"OrderAttachCategory":attchModel.orderAttachCategory,@"suffix":attchModel.suffix,@"Id":attchModel.attachId};
        [self.OrderAttachsModel1 addObject:param];
    }
    self.addOrderModel.OrderAttachs1 = self.OrderAttachsModel1;
    for (LKAttachModel *attchModel in self.addOrderModel.OrderAttachs2) {
        NSDictionary *param = @{@"AttachName":attchModel.attachName,@"AttachUrl":attchModel.attachUrl,@"OrderAttachCategory":attchModel.orderAttachCategory,@"suffix":attchModel.suffix,@"Id":attchModel.attachId};
        [self.OrderAttachsModel2 addObject:param];
    }
    self.addOrderModel.OrderAttachs2 = self.OrderAttachsModel2;
    for (LKAttachModel *attchModel in self.addOrderModel.OrderAttachs3) {
        NSDictionary *param = @{@"AttachName":attchModel.attachName,@"AttachUrl":attchModel.attachUrl,@"OrderAttachCategory":attchModel.orderAttachCategory,@"suffix":attchModel.suffix,@"Id":attchModel.attachId};
        [self.OrderAttachsModel3 addObject:param];
    }
    self.addOrderModel.OrderAttachs3 = self.OrderAttachsModel3;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSMutableArray *)OrderAttachsModel0{
    if (!_OrderAttachsModel0) {
        _OrderAttachsModel0 = [[NSMutableArray alloc] init];
    }
    return _OrderAttachsModel0;
}
-(NSMutableArray *)OrderAttachsModel1{
    if (!_OrderAttachsModel1) {
        _OrderAttachsModel1 = [[NSMutableArray alloc] init];
    }
    return _OrderAttachsModel1;
}
-(NSMutableArray *)OrderAttachsModel2{
    if (!_OrderAttachsModel2) {
        _OrderAttachsModel2 = [[NSMutableArray alloc] init];
    }
    return _OrderAttachsModel2;
}

/**
 取消上传变更附件
 */
-(void)dismissTheUpLoadBgView:(UIButton *)btn{
    [self.uploadBgView removeFromSuperview];
}

/**
 上传变更附件并获取信息

 */
-(void)uploadChangeFileAction:(UIButton *)btn{
    [self.uploadBgView removeFromSuperview];
    NSLog(@"图片信息%@",self.uploadChangeFileView.imageList);
//    self.waitSignal = YES;
    for (NSInteger i = 0; i < self.uploadChangeFileView.imageList.count; i++) {
        UIImage *image = self.uploadChangeFileView.imageList[i];
        [[LKNetDataManager defaultManager] sendPOSTRequestWithserverUrl:ServerlUrl apiPath:orderOfPictureUrl parameters:nil imageArray:@[image] targetWidth:100 progress:^(NSProgress * _Nullable progress) {
            
        } success:^(BOOL isSuccess, id  _Nullable responseObject) {
            
            LKCustomerAttachModel *attachModel = [[LKCustomerAttachModel alloc] init];
            attachModel.AttachName = responseObject[@"fileName"];
            attachModel.AttachUrl = responseObject[@"fileUrl"];
            attachModel.Suffix = responseObject[@"suffix"];
            attachModel.OrderAttachCategory = @"0";
            NSDictionary *dic = [attachModel properties_aps];
            [self.orderAttachsChangeArray addObject:dic];
            if (i == self.uploadChangeFileView.imageList.count - 1) {
                self.waitSignal = NO;
                [self submitOrderInformationWithbtn:nil];
            }
        } failure:^(NSString * _Nullable error) {
            
        }];
    }
    

}
-(NSMutableArray *)orderAttachsChangeArray{
    if (!_orderAttachsChangeArray) {
        _orderAttachsChangeArray = [[NSMutableArray alloc] init];
    }
    return _orderAttachsChangeArray;
}
-(NSMutableArray *)OrderAttachsModel3{
    if (!_OrderAttachsModel3) {
        _OrderAttachsModel3 = [[NSMutableArray alloc] init];
    }
    return _OrderAttachsModel3;
}
-(void)createBottomFuckView{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = cellHeaderBgColor;
    [self.view addSubview:footerView];
    [footerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.bottom.equalTo(self.view);
        make.right.equalTo(self.view);
        make.height.mas_equalTo(60);
    }];
    UIView *bottmView = [[UIView alloc] init];
    bottmView.backgroundColor = [UIColor whiteColor];
    [footerView addSubview:bottmView];
    [bottmView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(footerView);
        make.height.mas_equalTo(50);
    }];
    WS(weakSelf)
    LKBaseButton *saveBtn = [LKBaseButton buttonWithFrame:CGRectZero type:UIButtonTypeCustom title:@"保存" titleColor:blueDefault layercorne:1 font:[UIFont systemFontOfSize:12] backgroudColor:ColorRGB(242, 242, 242) AndActionBlock:^(UIButton *btn) {
        [weakSelf submitOrderInformationWithbtn:btn];
    }];
    [bottmView addSubview:saveBtn];
    [saveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bottmView.mas_left).offset(10);
        make.centerY.equalTo(bottmView);
        make.height.mas_equalTo(50);
    }];
    LKBaseButton *commitBtn = [LKBaseButton buttonWithFrame:CGRectZero type:UIButtonTypeCustom title:@"提交" titleColor:[UIColor whiteColor] layercorne:1 font:[UIFont systemFontOfSize:12] backgroudColor:blueDefault AndActionBlock:^(UIButton *btn) {
        
        [weakSelf submitOrderInformationWithbtn:btn];
        
    }];
    [bottmView addSubview:commitBtn];
    [commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bottmView.mas_right).offset(-10);
        make.centerY.equalTo(bottmView);
        make.left.equalTo(saveBtn.mas_right).offset(5);
        make.width.mas_equalTo(@[saveBtn]);
        make.height.mas_equalTo(50);
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
